package com.luojialong.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeUtils {

    public static final String dateFormatRule = "yyyy年MM月dd日";


    public static final String datetimeFormatRule = "yyyy年MM月dd日hh:mm:ss";


    public static String transferDateFormat(Date date) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatRule);
        return simpleDateFormat.format(date);
    }


    public static Date transferDateParse(String dateFormat) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormatRule);
        return simpleDateFormat.parse(dateFormat);
    }


    public static String transferDatetimeFormat(Date date) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datetimeFormatRule);
        return simpleDateFormat.format(date);
    }


    public static Date transferDatetimeParse(String dateFormat) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datetimeFormatRule);
        return simpleDateFormat.parse(dateFormat);
    }



}
